package com.nixwin.dpcd;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

import com.nixwin.dpcd.examples.StateExample;

public class Main {

	public static void main(String[] args){
		try{
			CodeGenerator gen = new CodeGenerator();
			
			Class c = StateExample.class;
			Method[] methods = c.getDeclaredMethods();
			for(Method m: methods){
				System.out.println(getSignature(m));
			
			}
		}catch(Exception e){}
	}

	private static String getSignature(Method m) {
		StringBuilder sbuilder = new StringBuilder();
		Modifier mod = new Modifier();
		String mods = getAppropriateModifiers(m);
		
		sbuilder.append(mods);
		sbuilder.append(" " + m.getReturnType().toString());
		sbuilder.append(" " + m.getName() + "(");
		
		Class<?>[] types = m.getParameterTypes();
		types[0].getClass
		
		return sbuilder.toString();
		
	}
	
	private static String getAppropriateModifiers(Method m){
		StringBuilder sbuilder = new StringBuilder();
	
		int modifiers = m.getModifiers();
		if(Modifier.isPublic(modifiers)){
			sbuilder.append("public");
		}
		if(Modifier.isPrivate(modifiers)){
			sbuilder.append("private");
		}
		if(Modifier.isFinal(modifiers)){
			sbuilder.append("final");
		}
		
		return sbuilder.toString();
	}



}
